home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 016a / nansi30.zip / NANSI.DOC next >
Text File  |  1990-07-14  |  24KB  |  793 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                          NANSI.SYS
  8.              An Enhanced MS-DOS Console Driver
  9.                   Version 3.0   July 1990
  10.  
  11.  
  12.  
  13.  
  14. _1.  _I_n_t_r_o_d_u_c_t_i_o_n - _W_h_o _s_h_o_u_l_d _u_s_e _N_A_N_S_I._S_Y_S
  15.  
  16. NANSI.SYS is a console device driver for MS-DOS  computers.   It  exe-
  17. cutes the same ANSI cursor control sequences as does the standard con-
  18. sole driver  ANSI.SYS,  but  significantly  faster.   It  also  offers
  19. several extra features.  Best of all, it is cheap, and its source code
  20. is available from the author.
  21.  
  22. You can benefit from using NANSI.SYS if:
  23. 1. you use programs (such as DIR, MORE, or NETHACK) which display text
  24. on the screen via DOS, or
  25. 2. you have an EGA or VGA, and want to use the 43- or 50-line mode  of
  26. your display, or
  27. 3. you run out of space when redefining keys with ANSI.SYS, or
  28. 4. you are a programmer who uses ANSI escape sequences, and are  frus-
  29. trated with slow display updates, or
  30. 5. you are porting display-intensive Unix programs to  run  under  MS-
  31. DOS.
  32.  
  33. You will not benefit from using NANSI.SYS if:
  34. 1. you never wish commands like TYPE or DIR were faster, and
  35. 2. you only use programs like Microsoft Word or  Word  Perfect,  which
  36. bypass DOS when displaying text, and
  37. 3. you aren't interested in displaying 43 lines of text on your EGA or
  38. VGA, and
  39. 4. you have never heard of ANSI.SYS anyway.
  40.  
  41. Installing NANSI.SYS will bring no improvement in  display  speed  for
  42. programs  that  bypass DOS (e.g. Microsoft Word), a 30% improvement in
  43. display speed with most programs that don't bypass DOS, a 50% improve-
  44. ment with "optimized" programs (see chapter below), and a 95% improve-
  45. ment with "optimized" programs that  avoid  scrolling.   (Yup,  that's
  46. right, 20 times faster!)
  47.  
  48. One "optimized" program, COPY /b foo.txt CON:,  comes  with  DOS.   To
  49. test  the  speed  improvement  yourself, create a long text file named
  50. foo.txt, and display it with  COPY  /b  foo.txt  con:  with  NANSI.SYS
  51. installed-  it  will  go  by very quickly.  This speed increase occurs
  52. even when running in a window in Microsoft Windows 3.0.
  53.  
  54. _2.  _C_o_m_p_a_t_i_b_i_l_i_t_y
  55.  
  56. NANSI.SYS has been tested on IBM PC/XT, /AT, and PS/2 systems, as well
  57. as  on  the Leading Edge model D.  It should run on any CGA, MDA, EGA,
  58. or VGA compatible video card.  It is compatible with Microsoft Windows
  59. 3.0.
  60.  
  61.  
  62.  
  63.  
  64.                             July 14, 1990
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                 - 2 -
  71.  
  72.  
  73. _3.  _C_o_p_y_r_i_g_h_t _s_t_a_t_u_s
  74.  
  75. This program and documentation is Copyright 1986, 1990  Daniel  Kegel.
  76. The  executable  program  and  its documentation may be freely distri-
  77. buted.
  78.  
  79. If you use this program for education or at home, you  are  encouraged
  80. to  send  a  US$10 donation to the author.  If you use it for business
  81. purposes, you are required to purchase a right-to-use license by send-
  82. ing US$10 to the author.
  83.  
  84. Copies of the driver on 360 KB floppy, together with printed  documen-
  85. tation,  may  be  obtained  from  the author for US$35.  Copies of the
  86. driver's source code are also available.
  87.  
  88. License fees, donations, and correspondence  (in  English  or  German)
  89. should be directed to the author at the following address:
  90.  
  91.         Daniel Kegel
  92.         221 Fairview Ave.
  93.         South Pasadena, CA. 91030 USA
  94.  
  95. or at the Internet E-mail address
  96.  
  97.         dank@moc.jpl.nasa.gov
  98.  
  99.  
  100. _4.  _V_e_r_s_i_o_n
  101.  
  102. The version number can be found with the DOS command TYPE NANSI.SYS.
  103. This documentation is for version 3.0, created July 1990.
  104.  
  105. _5.  _I_n_s_t_a_l_l_a_t_i_o_n _a_n_d _S_y_s_t_e_m _R_e_q_u_i_r_e_m_e_n_t_s
  106.  
  107. NANSI.SYS version 3.0 is distributed as  the  archive  NANSI30.ARC  or
  108. NANSI30.ZIP, with the following contents:
  109.  
  110.         NANSI.SYS - the device driver
  111.         NANSI.DOC - this documentation file
  112.         RAW.C     - how to set and clear RAW mode for faster screen output
  113.         RAW.H     - definitions for users of RAW.C
  114.  
  115.  
  116. NANSI.SYS requires MS-DOS version 2.0 or  higher,  and  uses  about  3
  117. kilobytes of system RAM.
  118.  
  119. To install NANSI.SYS on your computer, copy the file NANSI.SYS to your
  120. boot  disk  (usually  C:),  and include the following statement in the
  121. configuration file CONFIG.SYS on your boot disk:
  122.  
  123.         DEVICE=NANSI.SYS
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                             July 14, 1990
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                 - 3 -
  137.  
  138.  
  139. _6.  _A_N_S_I _C_o_n_t_r_o_l _S_e_q_u_e_n_c_e_s
  140.  
  141. While putting text up on the screen, NANSI.SYS keeps a lookout for the
  142. escape  character  (chr(27), known as ESC); this character signals the
  143. start of a terminal control sequence.  Terminal control sequences fol-
  144. low the format
  145.     ESC [ param; param; ...; param cmd
  146. where
  147.     ESC is the escape character chr$(27).
  148.     [ is the left bracket character.
  149.     param is an ASCII decimal number, or a string in quotes.
  150.     cmd is a case-specific letter identifying the command.
  151. Usually, zero, one, or two parameters are given.   If  parameters  are
  152. omitted, they usually default to 1; however, some commands (KKR) treat
  153. the no-parameter case  specially.   Spaces  are  not  allowed  between
  154. parameters.
  155.  
  156. For example, both ESC[1;1H and ESC[H send the cursor to the home posi-
  157. tion (1,1), which is the upper left.
  158.  
  159. In general, if you ask the cursor to go beyond the edge of the screen,
  160. it goes to the appropriate edge.  (ANSI.SYS was not always so nice.)
  161.  
  162. The following C macro illustrates how one could print a  string  at  a
  163. given location on the screen:
  164.     #define printXY(x,y,s)  printf("%c[%d;%dH%s", 27, y, x, s);
  165.  
  166. Either single or double quotes may be used to quote  a  string.   Each
  167. character  inside a quoted string is equivalent to one numeric parame-
  168. ter.  Quoted strings are normally used only for the Keyboard Key Reas-
  169. signment command.
  170.  
  171. Each ANSI control sequence supported by NANSI.SYS is described  below.
  172. The descriptions follow the format
  173.  
  174. _6._0._1.  _A_B_B_R_E_V_I_A_T_E_D__N_A_M_E: _w_h_a_t__t_o__s_e_n_d  _L_O_N_G _N_A_M_E
  175.  
  176. where ABBREVIATED_NAME is a short name for the sequence,  what_to_send
  177. tells  you  what  characters  make up the sequence, and LONG NAME is a
  178. long name for the sequence.
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.                             July 14, 1990
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                 - 4 -
  203.  
  204.  
  205. _6._1.  _S_e_q_u_e_n_c_e_s _d_e_a_l_i_n_g _w_i_t_h _C_u_r_s_o_r _P_o_s_i_t_i_o_n_i_n_g
  206.  
  207. _6._1._1.  _C_U_P: _E_S_C[#;#_H  _C_u_r_s_o_r _P_o_s_i_t_i_o_n
  208.  
  209. Moves the cursor to the position specified  by  the  parameters.   The
  210. first parameter, y, specifies the row number; the second parameter, x,
  211. specifies the column number.  If no parameters are given,  the  cursor
  212. is moved to (1,1), the upper left corner of the screen.
  213.  
  214.  
  215. _6._1._2.  _H_V_P: _E_S_C[#;#_f  _H_o_r_i_z_o_n_t_a_l _a_n_d _V_e_r_t_i_c_a_l _P_o_s_i_t_i_o_n
  216.  
  217. This is identical to Cursor Position.  Don't ask me why it exists.
  218.  
  219.  
  220. _6._1._3.  _C_U_U: _E_S_C[#_A    _C_u_r_s_o_r _U_p
  221.  
  222. Moves the cursor up the given number of rows without changing its hor-
  223. izontal position.
  224.  
  225.  
  226. _6._1._4.  _C_U_D: _E_S_C[#_B    _C_u_r_s_o_r _D_o_w_n
  227.  
  228. Moves the cursor down the given number of rows  without  changing  its
  229. horizontal position.
  230.  
  231.  
  232. _6._1._5.  _C_U_F: _E_S_C[#_C    _C_u_r_s_o_r _F_o_r_w_a_r_d
  233.  
  234. Moves the cursor right the given number of  columns  without  changing
  235. its vertical position.
  236.  
  237.  
  238. _6._1._6.  _C_U_B: _E_S_C[#_D    _C_u_r_s_o_r _B_a_c_k_w_a_r_d
  239.  
  240. Moves the cursor left the given number of columns without changing its
  241. vertical position.
  242.  
  243.  
  244. _6._1._7.  _D_S_R: _E_S_C[#_n    _D_e_v_i_c_e _S_t_a_t_u_s, _R_e_p_o_r_t!
  245.  
  246. # must be 6.  The sequence ESC[6n causes the console driver to  output
  247. a CPR (Cursor Position Report) sequence.
  248.  
  249. Note: This sequence is not supported by the  ANSI.SYS  emulator  built
  250. into Microsoft Windows 1.x or 2.x.
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                             July 14, 1990
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                 - 5 -
  269.  
  270.  
  271. _6._1._8.  _C_P_R: _E_S_C[#;#_R  _C_u_r_s_o_r _P_o_s_i_t_i_o_n _R_e_p_o_r_t
  272.  
  273. The console driver  outputs  this  sequence  upon  reciept  of  a  DSR
  274. sequence.   The first parameter is the cursor's vertical position; the
  275. second parameter is the cursor's horizontal position.
  276.  
  277. Note: Contrary to the  MS-DOS  manual,  ANSI.SYS  outputs  a  carriage
  278. return  after  this  sequence.   NANSI.SYS  faithfully reproduces this
  279. quirk.
  280.  
  281. The resulting string can have up to eleven characters.   For  example,
  282. if   you  have  a  100-line  display  (wow),  and  the  cursor  is  at
  283. (x=132,y=100), the string will be ESC[132;100R followed by a  carriage
  284. return.
  285.  
  286. This should never be sent to the console driver.
  287.  
  288. Also note: This sequence is not supported  by  the  ANSI.SYS  emulator
  289. built into Microsoft Windows 1.x or 2.x.
  290.  
  291. Here is an example of how to use DSR/CPR to find  the  current  cursor
  292. position with the C language:
  293.  
  294.         /* Code fragment to get current cursor X and Y from console */
  295.         /* Be sure to disable line-buffering on stdin before calling */
  296.         int x, y, c;
  297.         printf("\033[6n");
  298.         fflush(stdout);
  299.         if (getchar() != '\033' || getchar() != '[')
  300.             abort("Console not responding to DSR?");
  301.         for (y=0; isdigit(c=getchar()); y=y*10+(c-'0'));
  302.         if (c != ';')
  303.             abort("Console CPR faulty?");
  304.         for (x=0; isdigit(c=getchar()); x=x*10+(c-'0'));
  305.         if (c != 'R')
  306.             abort("Console CPR faulty?");
  307.         #ifndef VT100
  308.             getchar();  /* ignore trailing CR */
  309.         #endif
  310.  
  311.  
  312. This can also be useful for sensing screen size.
  313.  
  314.  
  315. _6._1._9.  _S_C_P: _E_S_C[_s      _S_a_v_e _C_u_r_s_o_r _P_o_s_i_t_i_o_n
  316.  
  317. Saves the cursor's X and Y locations in  an  internal  variable.   See
  318. RCP.
  319.  
  320.  
  321. _6._1._1_0.  _R_C_P: _E_S_C[_u    _R_e_s_t_o_r_e _C_u_r_s_o_r _P_o_s_i_t_i_o_n
  322.  
  323. Moves cursor to the position it held when the last  SCP  sequence  was
  324. received.
  325.  
  326.  
  327.  
  328.                             July 14, 1990
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                 - 6 -
  335.  
  336.  
  337. _6._2.  _S_e_q_u_e_n_c_e_s _t_h_a_t _E_d_i_t _t_h_e _D_i_s_p_l_a_y
  338.  
  339. _6._2._1.  _E_D: _E_S_C[#_J    _E_r_a_s_e _i_n _D_i_s_p_l_a_y
  340.  
  341. # must be 2.  Clears the entire screen.
  342.  
  343. Note: Contrary to the MS-DOS manual, ANSI.SYS also moves the cursor to
  344. the  upper  left corner of the screen.  Contrary to the ANSI standard,
  345. ANSI.SYS does not insist on # being 2.   NANSI.SYS  faithfully  repro-
  346. duces  these quirks.  (Version 2.2 of NANSI.SYS insisted on # being 2,
  347. and it caused compatibility problems with programs  that  ignored  the
  348. MS-DOS manual.)
  349.  
  350.  
  351. _6._2._2.  _E_L: _E_S_C[_K    _E_r_a_s_e _i_n _L_i_n_e
  352.  
  353. Deletes from the cursor to the end of the line.
  354.  
  355.  
  356. _6._2._3.  _I_L: _E_S_C[#_L    _I_n_s_e_r_t _L_i_n_e_s
  357.  
  358. The cursor line and all lines below it  move  down  #  lines,  leaving
  359. blank  space.   The  cursor  position  is unchanged.  The bottommost #
  360. lines are lost.
  361.  
  362. Note: This is not supported in ANSI.SYS.
  363.  
  364.  
  365. _6._2._4.  _D_L: _E_S_C[#_M    _D_e_l_e_t_e _L_i_n_e_s
  366.  
  367. The block of # lines at and below the cursor are  deleted;  all  lines
  368. below  them  move up # lines to fill in the gap, leaving # blank lines
  369. at the bottom of the screen.  The cursor position is unchanged.
  370.  
  371. Note: This is not supported in ANSI.SYS.
  372.  
  373.  
  374. _6._2._5.  _I_C_H: _E_S_C[#@    _I_n_s_e_r_t _C_h_a_r_a_c_t_e_r_s
  375.  
  376. The cursor character and all characters to the right of it move  right
  377. #  columns,  leaving  behind  blank  space.   The  cursor  position is
  378. unchanged.  The rightmost # characters on the line are lost.
  379.  
  380. Note: This is not supported in ANSI.SYS.
  381.  
  382.  
  383. _6._2._6.  _D_C_H: _E_S_C[#_P    _D_e_l_e_t_e _C_h_a_r_a_c_t_e_r_s
  384.  
  385. The block of # characters at and  to  the  right  of  the  cursor  are
  386. deleted;  all characters to the right of it move left # columns, leav-
  387. ing behind blank space.  The cursor position is unchanged.
  388.  
  389. Note: This is not supported in ANSI.SYS.
  390.  
  391.  
  392.  
  393.  
  394.                             July 14, 1990
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                 - 7 -
  401.  
  402.  
  403. _6._3.  _S_e_q_u_e_n_c_e_s _t_h_a_t _S_e_t _M_o_d_e_s
  404.  
  405. _6._3._1.  _K_K_R: _E_S_C["_s_t_r_i_n_g"_m   _K_e_y_b_o_a_r_d _K_e_y _R_e_a_s_s_i_g_n_m_e_n_t
  406.  
  407. The first char (or, for function keys, two chars) of the string  gives
  408. the  key  to  redefine; the rest of the string is the key's new value.
  409. To specify unprintable chars, give the ASCII value of the char outside
  410. of  quotes,  as  a  normal  parameter.  IBM function keys are two byte
  411. strings starting with zero.  For instance, ESC[0;59;"dir a:";13p rede-
  412. fines  function key 1 to have the value "dir a:" followed by the ENTER
  413. key.
  414.  
  415. There are about 500 bytes  available  to  hold  redefinition  strings.
  416. Once this space fills up, new strings are ignored.
  417.  
  418. To clear all definitions, send the string ESC[m.  (There was no way to
  419. do this in ANSI.SYS.)
  420.  
  421. Here's a table of the ASCII values of the common  function  keys;  for
  422. others,  see  the IBM Basic manual or the "IBM PS/2 and PC BIOS Inter-
  423. face Technical Reference".
  424.  
  425.         F1  0;59
  426.         F2  0;60
  427.         F3  0;61
  428.         F4  0;62
  429.         F5  0;63
  430.         F6  0;64
  431.         F7  0;65
  432.         F8  0;66
  433.         F9  0;67
  434.         F10 0;68
  435.  
  436. Note:  You  can't  currently  access  F11  and  F12.   IBM  made  this
  437. unpleasant  to  do;  you must use a different BIOS call to fetch keys,
  438. and that call also changes the meaning of several existing keys.
  439.  
  440.  
  441. _6._3._2.  _S_G_R: _E_S_C[#;#;...#_m  _S_e_t _G_r_a_p_h_i_c_s _R_e_n_d_i_t_i_o_n
  442.  
  443. The Set Graphics Rendition command is used to  select  foreground  and
  444. background  colors  or  attributes.  When you use multiple parameters,
  445. they are executed in sequence, and the effects are cumulative.
  446.  
  447.         Attrib     Value
  448.             0      All attributes off (normal white on black)
  449.             1      Bold
  450.             4      Underline
  451.             5      Blink
  452.             7      Reverse Video
  453.             30-37  foreground black/red/green/yellow/blue/magenta/cyan/white
  454.             40-47  background black/red/green/yellow/blue/magenta/cyan/white
  455.  
  456.  
  457.  
  458.  
  459.  
  460.                             July 14, 1990
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                 - 8 -
  467.  
  468.  
  469. _6._3._3.  _S_M: _E_S_C[=_n_h  _S_e_t _V_i_d_e_o _M_o_d_e
  470.  
  471. This sequence selects one of the available video modes. The  IBM  BIOS
  472. supports  several  video modes; the codes given in the BIOS documenta-
  473. tion are used as parameters to  the  Set  Mode  command.   (In  bitmap
  474. modes, the cursor is simulated with a small blob (^V).)
  475.  
  476.             Mode Code           Value
  477.                 0               text 40x25 Black & White
  478.                 1               text 40x25 Color
  479.                 2               text 80x25 Black & White
  480.                 3               text 80x25 Color
  481.                 4               bitmap 320x200 4 bits/pixel
  482.                 5               bitmap 320x200 1 bit/pixel
  483.                 6               bitmap 640x200 1 bit/pixel
  484.                 13              bitmap 320x200 4 bits/pixel
  485.                 14              bitmap 640x200 4 bits/pixel
  486.                 15              bitmap 640x350 1 bit/pixel
  487.                 16              bitmap 640x350 4 bits/pixel
  488.                 17              bitmap 640x480 1 bit/pixel
  489.                 18              bitmap 640x480 4 bits/pixel
  490.                 19              bitmap 320x200 8 bits/pixel
  491.  
  492.  
  493. Modes 0, 1, and 4-19 require a CGA, EGA or VGA.
  494. Modes 13-16 require an EGA or VGA.
  495. Modes 17-19 require a VGA.
  496. Other graphics cards may support other video modes.
  497.  
  498. The EGA and VGA let you use a shorter character cell in text modes  in
  499. order to squeeze more lines of text out of the 25-line text modes.  To
  500. enter short line mode, set the desired 25-line text  mode  (0  to  3),
  501. then Set Mode 43.  For instance: ESC[=3h ESC[=43h.  To exit short line
  502. mode, set the desired 25-line text mode again.  On IBM VGA cards, this
  503. sequence gives you a 50 line screen.  NANSI.SYS ignores mode 43 unless
  504. there is an EGA or VGA on your computer.
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.                             July 14, 1990
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                 - 9 -
  533.  
  534.  
  535. _6._3._4.  _S_M: _E_S_C[?_n_h  _S_e_t _N_o_n_v_i_d_e_o _M_o_d_e
  536.  
  537. This sequence is used to set non-video modes.   The  only  value  sup-
  538. ported is
  539.  
  540.             Mode Code           Value when set
  541.                 7               Cursor wraps at end of line
  542.  
  543.  
  544. Setting mode 7 tells the cursor to wrap around to the next  line  when
  545. it passes the end of a line.
  546.  
  547. _6._3._5.  _R_M: _E_S_C[?_n_l  _R_e_s_e_t _N_o_n_v_i_d_e_o _M_o_d_e
  548.  
  549. This sequence is used to reset non-video modes.  The only  value  sup-
  550. ported is
  551.  
  552.             Mode Code           Value when reset
  553.                 7               Cursor stops at end of line
  554.  
  555.  
  556. Resetting mode 7 tells the cursor to 'stick' at the end  of  the  line
  557. instead of wrapping to the next line.
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.                             July 14, 1990
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                 - 10 -
  599.  
  600.  
  601. _7.  _B_a_c_k_g_r_o_u_n_d - _W_h_a_t _d_o_e_s _a _c_o_n_s_o_l_e _d_r_i_v_e_r _d_o, _a_n_d _h_o_w?
  602.  
  603. A console driver consists of subroutines which are called  by  MS-DOS.
  604. MS-DOS itself is mostly just subroutines which can be called by appli-
  605. cation programs.
  606.  
  607. Programs that want to display text on the screen can call the  "Write"
  608. subroutine  provided  by  MS-DOS.   This  subroutine in turn calls the
  609. "Write" subroutine of the console driver.
  610.  
  611. When you, for example, type
  612.     C> type foo.txt
  613. COMMAND.COM uses the "Read" subroutine of  MS-DOS  to  read  the  file
  614. "foo.txt" from the disk; it then uses the "Write" subroutine of MS-DOS
  615. with the file's contents.  MS-DOS  then  calls  the  console  driver's
  616. "Write" subroutine, which finally puts the data up on the screen.
  617.  
  618. Both ANSI.SYS and NANSI.SYS use IBM Video BIOS to control the  screen.
  619. However,  NANSI.SYS  writes directly to the screen in text modes; this
  620. allows much faster operation.
  621.  
  622.  
  623. _8.  _H_o_w _t_o _D_i_s_p_l_a_y _T_e_x_t _Q_u_i_c_k_l_y
  624.  
  625. Output to the screen via DOS is usually slow  because  characters  are
  626. sent  one-at-a-time  through  several layers of software.  Application
  627. programs often call a DOS function for each character or line.
  628.  
  629. To avoid this overhead, application  programs  should  write  as  many
  630. characters  per  DOS call as possible (in C programs, this means using
  631. setbuf(), fflush(), and buffered output).
  632.  
  633. Another problem is that application programs sometimes send line after
  634. line  of  text,  letting  the cursor stay at the bottom of the screen.
  635. This forces the console driver to scroll the entire screen up once for
  636. each line displayed, which is rather expensive.
  637.  
  638. This can be fixed by having the application program clear  the  screen
  639. and home the cursor after each page of output.
  640.  
  641. Finally, the biggest problem is that DOS calls the device driver  once
  642. or twice for each character written.
  643.  
  644. Fortunately, DOS can be told to pass the entire write request directly
  645. to  the device driver; this is called "raw" mode.  The files RAW.C and
  646. RAW.H, included in this package, provide an easy way to set and  clear
  647. "raw"  mode, to turn break checking on and off, and to check for keys-
  648. trokes when in raw mode.
  649.  
  650. Even if you follow all these rules, output with ANSI.SYS will still be
  651. very  slow,  simply  because ANSI.SYS was written to be portable, with
  652. total disregard for performance.  NANSI.SYS, on the  other  hand,  was
  653. written by a performance fanatic.
  654.  
  655.  
  656.  
  657.  
  658.                             July 14, 1990
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                                 - 11 -
  665.  
  666.  
  667. _9.  _N_A_N_S_I _a_n_d _M_i_c_r_o_s_o_f_t _W_i_n_d_o_w_s
  668.  
  669. Microsoft Windows 1.x and 2.x allowed you to run command.com in a win-
  670. dow,  but did not give you access to NANSI.SYS.  Windows 3.0 gives you
  671. full access to NANSI.SYS, even when running command.com  in  a  window
  672. (wow!).   However,  you  can only do this if you have a 386-based com-
  673. puter (boo, hiss); on other computers, Windows runs  command.com  only
  674. in full screen mode.
  675.  
  676. Under Microsoft Windows 3.0, if you write text to stdout in RAW  mode,
  677. the display is not refreshed until the end of the write; no intermedi-
  678. ate scrolling is shown.  I suspect this  is  because  Windows  doesn't
  679. refresh the display until display memory hasn't been touched for a few
  680. milliseconds.
  681.  
  682. _1_0.  _E_n_h_a_n_c_e_m_e_n_t_s _s_i_n_c_e _v_e_r_s_i_o_n _2._2 _o_f _N_A_N_S_I._S_Y_S
  683.  
  684. Now obeys BIOS's idea of number of screen lines, when supported.
  685.  
  686. Works properly when on video pages greater than zero, too.
  687.  
  688. Supports 132-column displays.
  689.  
  690. Deleted Output Character Translation feature.  It took up  260  bytes,
  691. and nobody ever used it.
  692.  
  693. Fixed bug related to setting background color while in graphics mode.
  694.  
  695. No longer assumes AH is zero upon entry to driver.
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.                             July 14, 1990
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                                 - 12 -
  731.  
  732.  
  733. _1_1.  _L_i_m_i_t_a_t_i_o_n_s _i_n _t_h_e _c_u_r_r_e_n_t _v_e_r_s_i_o_n _o_f _N_A_N_S_I._S_Y_S
  734.  
  735. All parameter values must be between 0 and 255.
  736.  
  737. The maximum number of characters available for  keyboard  redefinition
  738. is  500.   Any  single  keyboard  redefinition escape sequence must be
  739. shorter than (500 - (total keyboard redefinition space already  used))
  740. bytes.
  741.  
  742. The user should be able to turn off keyboard redefinition, due to  the
  743. possibility  that  this  feature can be used for a Trojan Horse attack
  744. via E-Mail or public domain program documentation.
  745.  
  746. Insert and delete character do not work in graphics modes.
  747.  
  748. Graphics mode writing is slow.
  749.  
  750. The simulated cursor in graphics mode slows down single-char writes by
  751. a  factor  of  3; it should be disable-able.  Better yet, it should be
  752. visible only when waiting for keyboard input.
  753.  
  754. Does not support erase-to-end-of-screen and other useful functions.
  755.  
  756. Nansi determines whether a video mode is graphics or text  by  looking
  757. at  the  mode  number.   Unrecognized modes are assumed to be graphics
  758. modes.  This means that performance is poor on  text  modes  with  new
  759. mode  numbers  (as  found on some manufacturers' super-EGA cards).  If
  760. possible, set these modes without changing the BIOS video mode number,
  761. or  force the BIOS video mode number [40h:49h] back to 3 after setting
  762. these modes.
  763.  
  764. Nansi determines whether the BIOS number-of-screen-lines  variable  is
  765. supported by checking for an EGA card.  There might be a better way.
  766.  
  767. Nansi only checks for an EGA or VGA card at startup time.  If you have
  768. two  video  cards  installed, and one shows more text lines per screen
  769. than the other, AND you switch between the  cards  without  rebooting,
  770. Nansi could conceivably become confused about the number of text lines
  771. on the screen.
  772.  
  773. Nansi currently assumes that function keys start with a zero byte. The
  774. new keys (e.g. F11 and F12) don't, so Nansi will have to change a lit-
  775. tle to support them.
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.                             July 14, 1990
  791.  
  792.  
  793.